#ifndef _VL_RTSP_TCP_DISPATCHER__H_
#define _VL_RTSP_TCP_DISPATCHER__H_

#include "defs.h"
#include "media_dispatcher.h"

namespace VLRTSP {

/**
 * @Author: CimZzz
 * @Date: 2022-01-16 23:52:10
 * 
 * TCP 媒体数据分发器
 */
class TCPDispatcher: public MediaDispatcher {

public:
	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-17 00:01:29
	 * 
	 * 构造函数
	 * @param writeQueue 写队列
 	 * @param id 媒体分发器 Id
	 * @param rtpSendPoint RTP 发送端口 / Channel
	 * @param rtcpSendPoint RTCP 发送端口 / Channel
	 * @param mediaSource 媒体资源
	 */
	explicit TCPDispatcher(
		QueueThread<Buffer>* writeQueue,
		uint32_t id,
		uint32_t rtpSendPoint,
		uint32_t rtcpSendPoint,
		std::shared_ptr<MediaSource> mediaSource
	);

	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-17 00:01:41
	 * 
	 * 析构函数
	 */
	~TCPDispatcher();

protected:

	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-17 00:02:24
	 * 
	 * 消息队列回调函数
	 * @param sendBuffer 待发送的 RTP 帧
	 */
	virtual void onRecvSendBuffer(std::shared_ptr<RTPFrame>& sendBuffer);

private:
	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-17 00:03:16
	 * 
	 * 写队列
	 */
	QueueThread<Buffer>* writeQueue;
};

}

#endif //_VL_RTSP_TCP_DISPATCHER__H_
